package cn.com.zpark.servlet_request;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @PackageName: cn.com.zpark.servlet_request
 * @ClassName: RequestDemo01
 * @Description:
 * @author: RZS
 * @date: 2021/11/14  15:09
 */
@WebServlet("/rd1.do")
public class RequestDemo01 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        /**
         * 获取HTTP 请求的请求行中包含请求方法、请求资源名、请求路径等信息
         */
        System.out.println(request.getMethod());
        System.out.println(request.getRequestURI());
        System.out.println(request.getQueryString());
        System.out.println(request.getContextPath());
        System.out.println(request.getServletPath());
        System.out.println(request.getRemoteAddr());
        System.out.println(request.getRemoteHost());
    }
}
